﻿namespace MvcApplication1.ViewsModel
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Domain.Interface;
    using Domain.Model;
    using StructureMap;
    using StructureMap.Attributes;

    public class ResourceViewModel : BaseViewModel
    {
        #region properties

        public IResourceComponent ResourceComponent { get; set; }

        #endregion

        #region ctor

        public ResourceViewModel()
        {
            ResourceComponent = ObjectFactory.GetInstance<IResourceComponent>();
        }

        #endregion

        #region component calls

        /// <summary>
        /// Add
        /// </summary>
        public void AddResource(Resource entity)
        {
            ResourceComponent.AddResource(entity);
        }

        /// <summary>
        /// Delete
        /// </summary>
        public void DeleteResource(Resource entity)
        {
            ResourceComponent.DeleteResource(entity);
        }


        /// <summary>
        /// Get
        /// </summary>
        public IEnumerable<Resource> GetResources()
        {
            return ResourceComponent.GetResources();
        }

        #endregion
    }
}